﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.JointVariableLimitsEditor.CUiJVLEditorSettingsForm
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using Tecnomatix.Engineering.Ui;
using UiInternalControls.WindowsFormsControls;
using UiInternalControls.WindowsFormsControls.GraphEnums;


namespace DnProcessSimulateCommands.JointVariableLimitsEditor;

internal class CUiJVLEditorSettingsForm : TxForm
{
  private const string SETTINGS_COLOR_DIALOG_PATH = "ColorDialog";
  private const string SETTINGS_COLOR_DIALOG_POS = "DialogPos";
  private const string SETTINGS_COLOR_DIALOG_CUSTOM_COLORS = "CustomColors";
  private CUiJVLEditorViewModelSettings.GraphSettings _graphSettings;
  private ImageList _regularPointShapeImageList;
  private ImageList _selectedPointShapeImageList;
  private ImageList _lineTypeImageList;
  private ToolTip _tt;
  private CUiJVLEditorColorDialog _colorDlg;
  private CUiJVLEditorSettingsForm.ColorDialogSettings _colorDlgSettings;
  private IContainer components;
  private GroupBox _graphGroupBox;
  private Button _okButton;
  private Button _cancelButton;
  private TxColorSelectButton _regularPointColorButton;
  private CUiJVLEditorImageComboBox _regularPointShapeCombo;
  private Label _regularPointLabel;
  private TxColorSelectButton _areaColorButton;
  private Label _areaLabel;
  private TxColorSelectButton _lineColorButton;
  private CUiJVLEditorImageComboBox _lineTypeCombo;
  private Label _lineLabel;
  private TxColorSelectButton _selectedPointColorButton;
  private CUiJVLEditorImageComboBox _selectedPointShapeCombo;
  private Label _selectedPointLabel;

  public CUiJVLEditorSettingsForm(
    CUiJVLEditorViewModelSettings.GraphSettings graphSettings)
  {
    this._graphSettings = new CUiJVLEditorViewModelSettings.GraphSettings(graphSettings);
    this._colorDlg = (CUiJVLEditorColorDialog) null;
    this._colorDlgSettings = new CUiJVLEditorSettingsForm.ColorDialogSettings();
    this.InitializeComponent();
    this.setTooltips();
  }

  protected virtual void OnLoad(EventArgs e)
  {
    base.OnLoad(e);
    this.createPointImages((ComboBox) this._regularPointShapeCombo, ref this._regularPointShapeImageList);
    this.createPointImages((ComboBox) this._selectedPointShapeCombo, ref this._selectedPointShapeImageList);
    this.createLineImages((ComboBox) this._lineTypeCombo, ref this._lineTypeImageList);
    List<CUiJVLEditorSettingsForm.ePointShape> ePointShapeList1 = new List<CUiJVLEditorSettingsForm.ePointShape>();
    for (int index = 0; index < this._regularPointShapeImageList.Images.Count; ++index)
    {
      CUiJVLEditorSettingsForm.ePointShape ePointShape = (CUiJVLEditorSettingsForm.ePointShape) index;
      ePointShapeList1.Add(ePointShape);
      this._regularPointShapeCombo.SetItemImage((object) ePointShape, this._regularPointShapeImageList.Images[index]);
    }
    this._regularPointShapeCombo.DataSource = (object) ePointShapeList1;
    this._regularPointShapeCombo.SelectedItem = (object) this.toLocalPointShape(this._graphSettings.RegularPointShape);
    List<CUiJVLEditorSettingsForm.ePointShape> ePointShapeList2 = new List<CUiJVLEditorSettingsForm.ePointShape>();
    for (int index = 0; index < this._selectedPointShapeImageList.Images.Count; ++index)
    {
      CUiJVLEditorSettingsForm.ePointShape ePointShape = (CUiJVLEditorSettingsForm.ePointShape) index;
      ePointShapeList2.Add(ePointShape);
      this._selectedPointShapeCombo.SetItemImage((object) ePointShape, this._selectedPointShapeImageList.Images[index]);
    }
    this._selectedPointShapeCombo.DataSource = (object) ePointShapeList2;
    this._selectedPointShapeCombo.SelectedItem = (object) this.toLocalPointShape(this._graphSettings.SelectedPointShape);
    List<CUiJVLEditorSettingsForm.eLineType> eLineTypeList = new List<CUiJVLEditorSettingsForm.eLineType>();
    for (int index = 0; index < this._lineTypeImageList.Images.Count; ++index)
    {
      CUiJVLEditorSettingsForm.eLineType eLineType = (CUiJVLEditorSettingsForm.eLineType) index;
      eLineTypeList.Add(eLineType);
      this._lineTypeCombo.SetItemImage((object) eLineType, this._lineTypeImageList.Images[index]);
    }
    this._lineTypeCombo.DataSource = (object) eLineTypeList;
    this._lineTypeCombo.SelectedItem = (object) this.toLocalLineType(this._graphSettings.LineType);
    this._regularPointColorButton.SelectedColor = this._graphSettings.RegularPointColor;
    this._selectedPointColorButton.SelectedColor = this._graphSettings.SelectedPointColor;
    this._lineColorButton.SelectedColor = this._graphSettings.LineColor;
    this._areaColorButton.SelectedColor = this._graphSettings.AreaColor;
    this.loadSettings();
  }

  protected virtual void OnFormClosing(FormClosingEventArgs e)
  {
    this.storeSettings();
    if (this._colorDlg != null)
    {
      this._colorDlg.Dispose();
      this._colorDlg = (CUiJVLEditorColorDialog) null;
    }
    // ISSUE: explicit non-virtual call
    __nonvirtual (((Form) this).OnFormClosing(e));
  }

  internal CUiJVLEditorViewModelSettings.GraphSettings GraphSettings => this._graphSettings;

  private void setTooltips()
  {
    this._tt = new ToolTip();
    this._tt.SetToolTip((Control) this._regularPointShapeCombo, DnProcessSimulateCommands.JointVariableLimitsEditor.Resources.StringTable.TT_SETTINGS_GRAPH_REGULAR_POINT_SHAPE);
    this._tt.SetToolTip((Control) this._regularPointColorButton, DnProcessSimulateCommands.JointVariableLimitsEditor.Resources.StringTable.TT_SETTINGS_GRAPH_REGULAR_POINT_COLOR);
    this._tt.SetToolTip((Control) this._selectedPointShapeCombo, DnProcessSimulateCommands.JointVariableLimitsEditor.Resources.StringTable.TT_SETTINGS_GRAPH_SELECTED_POINT_SHAPE);
    this._tt.SetToolTip((Control) this._selectedPointColorButton, DnProcessSimulateCommands.JointVariableLimitsEditor.Resources.StringTable.TT_SETTINGS_GRAPH_SELECTED_POINT_COLOR);
    this._tt.SetToolTip((Control) this._lineTypeCombo, DnProcessSimulateCommands.JointVariableLimitsEditor.Resources.StringTable.TT_SETTINGS_GRAPH_LINE_STYLE);
    this._tt.SetToolTip((Control) this._lineColorButton, DnProcessSimulateCommands.JointVariableLimitsEditor.Resources.StringTable.TT_SETTINGS_GRAPH_LINE_COLOR);
    this._tt.SetToolTip((Control) this._areaColorButton, DnProcessSimulateCommands.JointVariableLimitsEditor.Resources.StringTable.TT_SETTINGS_GRAPH_AREA_COLOR);
  }

  private void updateSettingsFromUI()
  {
    this._graphSettings.RegularPointShape = this.fromLocalPointShape((CUiJVLEditorSettingsForm.ePointShape) this._regularPointShapeCombo.SelectedItem);
    this._graphSettings.RegularPointColor = this._regularPointColorButton.SelectedColor;
    this._graphSettings.SelectedPointShape = this.fromLocalPointShape((CUiJVLEditorSettingsForm.ePointShape) this._selectedPointShapeCombo.SelectedItem);
    this._graphSettings.SelectedPointColor = this._selectedPointColorButton.SelectedColor;
    this._graphSettings.LineType = this.fromLocalLineType((CUiJVLEditorSettingsForm.eLineType) this._lineTypeCombo.SelectedItem);
    this._graphSettings.LineColor = this._lineColorButton.SelectedColor;
    this._graphSettings.AreaColor = this._areaColorButton.SelectedColor;
  }

  private void createLineImages(ComboBox combo, ref ImageList imageList)
  {
    imageList = new ImageList();
    double num = 1.0 - 15.0 / 50.0;
    Rectangle displayRectangle = combo.DisplayRectangle;
    imageList.ImageSize = new Size(displayRectangle.Width, (int) ((double) displayRectangle.Height * num));
    for (int index = 0; index < 5; ++index)
    {
      float lineWidth = 0.0f;
      switch (index)
      {
        case 0:
          lineWidth = 1f;
          break;
        case 1:
          lineWidth = 2f;
          break;
        case 2:
          lineWidth = 3f;
          break;
        case 3:
          lineWidth = 4f;
          break;
        case 4:
          lineWidth = 5f;
          break;
      }
      imageList.Images.Add(this.createLineImage(imageList, lineWidth));
    }
  }

  private void createPointImages(ComboBox combo, ref ImageList imageList)
  {
    imageList = new ImageList();
    double num = 1.0 - 15.0 / 50.0;
    Rectangle displayRectangle = combo.DisplayRectangle;
    imageList.ImageSize = new Size((int) ((double) displayRectangle.Width * num), (int) ((double) displayRectangle.Height * num));
    for (int pointShape = 0; pointShape < 6; ++pointShape)
      imageList.Images.Add(this.createPointImage(imageList, (CUiJVLEditorSettingsForm.ePointShape) pointShape));
  }

  private Image createLineImage(ImageList imageList, float lineWidth)
  {
    Bitmap lineImage = (Bitmap) null;
    if (imageList != null)
    {
      Size imageSize = imageList.ImageSize;
      int width = imageSize.Width;
      imageSize = imageList.ImageSize;
      int height = imageSize.Height;
      lineImage = new Bitmap(width, height);
      Graphics graphics = Graphics.FromImage((Image) lineImage);
      graphics.Clear(imageList.TransparentColor);
      using (Pen pen = new Pen(Color.FromArgb(0, 0, 0), lineWidth))
        graphics.DrawLine(pen, new PointF(0.0f, (float) lineImage.Height / 2f), new PointF((float) lineImage.Width, (float) lineImage.Height / 2f));
      lineImage.MakeTransparent(imageList.TransparentColor);
    }
    return (Image) lineImage;
  }

  private Image createPointImage(
    ImageList imageList,
    CUiJVLEditorSettingsForm.ePointShape pointShape)
  {
    Size imageSize = imageList.ImageSize;
    int width1 = imageSize.Width;
    imageSize = imageList.ImageSize;
    int height = imageSize.Height;
    Bitmap pointImage = new Bitmap(width1, height);
    Graphics graphics = Graphics.FromImage((Image) pointImage);
    graphics.Clear(imageList.TransparentColor);
    Color color = Color.FromArgb(0, 0, 0);
    int width2 = 1;
    float num1 = 1f;
    float num2 = (float) pointImage.Height - 2f * num1;
    RectangleF rect = new RectangleF(num1, num1, num2, num2);
    switch (pointShape)
    {
      case CUiJVLEditorSettingsForm.ePointShape.Square:
        using (Pen pen = new Pen(color, (float) width2))
        {
          graphics.DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height);
          break;
        }
      case CUiJVLEditorSettingsForm.ePointShape.SolidSquare:
        using (Pen pen = new Pen(color, (float) width2))
        {
          using (Brush brush = (Brush) new SolidBrush(color))
          {
            graphics.DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height);
            graphics.FillRectangle(brush, rect);
            break;
          }
        }
      case CUiJVLEditorSettingsForm.ePointShape.Diamond:
        using (Pen pen = new Pen(color, (float) width2))
        {
          PointF[] points = new PointF[4]
          {
            new PointF(rect.X + rect.Width / 2f, rect.Top),
            new PointF(rect.Right, rect.Top + rect.Height / 2f),
            new PointF(rect.X + rect.Width / 2f, rect.Bottom),
            new PointF(rect.Left, rect.Top + rect.Height / 2f)
          };
          graphics.DrawPolygon(pen, points);
          break;
        }
      case CUiJVLEditorSettingsForm.ePointShape.SolidDiamond:
        using (Pen pen = new Pen(color, (float) width2))
        {
          using (Brush brush = (Brush) new SolidBrush(color))
          {
            PointF[] points = new PointF[4]
            {
              new PointF(rect.X + rect.Width / 2f, rect.Top),
              new PointF(rect.Right, rect.Top + rect.Height / 2f),
              new PointF(rect.X + rect.Width / 2f, rect.Bottom),
              new PointF(rect.Left, rect.Top + rect.Height / 2f)
            };
            graphics.DrawPolygon(pen, points);
            graphics.FillPolygon(brush, points);
            break;
          }
        }
      case CUiJVLEditorSettingsForm.ePointShape.Circle:
        using (Pen pen = new Pen(color, (float) width2))
        {
          graphics.DrawEllipse(pen, rect);
          break;
        }
      case CUiJVLEditorSettingsForm.ePointShape.SolidCircle:
        using (Pen pen = new Pen(color, (float) width2))
        {
          using (Brush brush = (Brush) new SolidBrush(color))
          {
            graphics.DrawEllipse(pen, rect);
            graphics.FillEllipse(brush, rect);
            break;
          }
        }
    }
    pointImage.MakeTransparent(imageList.TransparentColor);
    return (Image) pointImage;
  }

  private CUiJVLEditorSettingsForm.ePointShape toLocalPointShape(PointShapeType shape)
  {
    CUiJVLEditorSettingsForm.ePointShape localPointShape = CUiJVLEditorSettingsForm.ePointShape.SolidSquare;
    switch (shape - 2)
    {
      case 0:
        localPointShape = CUiJVLEditorSettingsForm.ePointShape.Circle;
        break;
      case 1:
        localPointShape = CUiJVLEditorSettingsForm.ePointShape.SolidCircle;
        break;
      case 2:
        localPointShape = CUiJVLEditorSettingsForm.ePointShape.Square;
        break;
      case 3:
        localPointShape = CUiJVLEditorSettingsForm.ePointShape.SolidSquare;
        break;
      case 4:
        localPointShape = CUiJVLEditorSettingsForm.ePointShape.Diamond;
        break;
      case 5:
        localPointShape = CUiJVLEditorSettingsForm.ePointShape.SolidDiamond;
        break;
    }
    return localPointShape;
  }

  private PointShapeType fromLocalPointShape(CUiJVLEditorSettingsForm.ePointShape shape)
  {
    PointShapeType pointShapeType = (PointShapeType) 5;
    switch (shape)
    {
      case CUiJVLEditorSettingsForm.ePointShape.Square:
        pointShapeType = (PointShapeType) 4;
        break;
      case CUiJVLEditorSettingsForm.ePointShape.SolidSquare:
        pointShapeType = (PointShapeType) 5;
        break;
      case CUiJVLEditorSettingsForm.ePointShape.Diamond:
        pointShapeType = (PointShapeType) 6;
        break;
      case CUiJVLEditorSettingsForm.ePointShape.SolidDiamond:
        pointShapeType = (PointShapeType) 7;
        break;
      case CUiJVLEditorSettingsForm.ePointShape.Circle:
        pointShapeType = (PointShapeType) 2;
        break;
      case CUiJVLEditorSettingsForm.ePointShape.SolidCircle:
        pointShapeType = (PointShapeType) 3;
        break;
    }
    return pointShapeType;
  }

  private CUiJVLEditorSettingsForm.eLineType toLocalLineType(LineType lineType)
  {
    CUiJVLEditorSettingsForm.eLineType localLineType = CUiJVLEditorSettingsForm.eLineType.Width_1px;
    if (lineType != null)
    {
      switch (lineType - 5)
      {
        case 0:
          localLineType = CUiJVLEditorSettingsForm.eLineType.Width_3px;
          break;
        case 1:
          localLineType = CUiJVLEditorSettingsForm.eLineType.Width_5px;
          break;
        case 4:
          localLineType = CUiJVLEditorSettingsForm.eLineType.Width_2px;
          break;
        case 5:
          localLineType = CUiJVLEditorSettingsForm.eLineType.Width_4px;
          break;
      }
    }
    else
      localLineType = CUiJVLEditorSettingsForm.eLineType.Width_1px;
    return localLineType;
  }

  private LineType fromLocalLineType(CUiJVLEditorSettingsForm.eLineType lineType)
  {
    LineType lineType1 = (LineType) 0;
    switch (lineType)
    {
      case CUiJVLEditorSettingsForm.eLineType.Width_1px:
        lineType1 = (LineType) 0;
        break;
      case CUiJVLEditorSettingsForm.eLineType.Width_2px:
        lineType1 = (LineType) 9;
        break;
      case CUiJVLEditorSettingsForm.eLineType.Width_3px:
        lineType1 = (LineType) 5;
        break;
      case CUiJVLEditorSettingsForm.eLineType.Width_4px:
        lineType1 = (LineType) 10;
        break;
      case CUiJVLEditorSettingsForm.eLineType.Width_5px:
        lineType1 = (LineType) 6;
        break;
    }
    return lineType1;
  }

  private bool loadSettings()
  {
    CUiJVLEditorSettingsForm.ColorDialogSettings colorDialogSettings = new CUiJVLEditorSettingsForm.ColorDialogSettings();
    string s;
    bool flag1 = this.loadSettingsValue("ColorDialog", "DialogPos", out s);
    if (flag1)
    {
      Point point;
      flag1 = this.fromSettingsString(s, out point);
      if (flag1)
        colorDialogSettings.Pos = new Point?(point);
    }
    bool flag2 = flag1 && this.loadSettingsValue("ColorDialog", "CustomColors", out s);
    if (flag2)
    {
      int[] numArray;
      flag2 = this.fromSettingsString(s, out numArray);
      if (flag2)
        colorDialogSettings.CustomColors = numArray;
    }
    if (flag2)
      this._colorDlgSettings = colorDialogSettings;
    return flag2;
  }

  private bool storeSettings()
  {
    bool flag = this.storeSettingsValue("ColorDialog", "DialogPos", this._colorDlgSettings.Pos.HasValue ? this.toSettingsString(this._colorDlgSettings.Pos.Value) : string.Empty);
    int[] customColors = this._colorDlgSettings.CustomColors;
    string str = customColors != null ? this.toSettingsString(customColors) : string.Empty;
    return flag && this.storeSettingsValue("ColorDialog", "CustomColors", str);
  }

  private bool loadSettingsValue(string collectionRelativePath, string propName, out string value)
  {
    bool flag = false;
    value = (string) null;
    try
    {
      object obj;
      TxFormSettings.RestoreFormValue((Form) this, collectionRelativePath, propName, ref obj);
      if (obj != null)
      {
        value = obj.ToString();
        flag = true;
      }
    }
    catch (Exception ex)
    {
      value = (string) null;
      flag = false;
    }
    return flag;
  }

  private bool storeSettingsValue(string collectionRelativePath, string propName, string value)
  {
    try
    {
      TxFormSettings.StoreFormValue((Form) this, collectionRelativePath, propName, value);
      return true;
    }
    catch (Exception ex)
    {
      return false;
    }
  }

  private bool fromSettingsString(string s, out Point value)
  {
    value = Point.Empty;
    string[] separator = new string[1]{ ";" };
    string[] strArray = s.Split(separator, 2, StringSplitOptions.None);
    int result1;
    int result2;
    if (strArray.Length != 2 || !int.TryParse(strArray[0], out result1) || !int.TryParse(strArray[1], out result2))
      return false;
    value = new Point(result1, result2);
    return true;
  }

  private string toSettingsString(Point point)
  {
    int num = point.X;
    string str1 = num.ToString();
    num = point.Y;
    string str2 = num.ToString();
    return $"{str1};{str2}";
  }

  private bool fromSettingsString(string s, out int[] value)
  {
    value = (int[]) null;
    string[] separator = new string[1]{ ";" };
    string[] strArray = s.Split(separator, StringSplitOptions.None);
    if (strArray.Length == 0)
      return false;
    value = new int[strArray.Length];
    for (int index = 0; index < strArray.Length; ++index)
    {
      if (!int.TryParse(strArray[index], out value[index]))
      {
        value = (int[]) null;
        return false;
      }
    }
    return true;
  }

  private string toSettingsString(int[] values)
  {
    string empty = string.Empty;
    if (values != null)
    {
      for (int index = 0; index < values.Length; ++index)
      {
        if (index > 0)
          empty += ";";
        empty += values[index].ToString();
      }
    }
    return empty;
  }

  private void beforeOpenColorDialog()
  {
    if (this._colorDlg == null)
    {
      this._colorDlg = new CUiJVLEditorColorDialog();
      int[] customColors = this._colorDlgSettings.CustomColors;
      if (customColors != null)
        this._colorDlg.CustomColors = customColors;
    }
    this._colorDlg.Pos = this._colorDlgSettings.Pos;
  }

  private void afterCloseColorDialog() => this._colorDlgSettings.Pos = this._colorDlg.Pos;

  private void _okButton_Click(object sender, EventArgs e)
  {
    ((Form) this).DialogResult = DialogResult.OK;
    this.updateSettingsFromUI();
    ((Form) this).Close();
  }

  private void _cancelButton_Click(object sender, EventArgs e)
  {
    ((Form) this).DialogResult = DialogResult.Cancel;
    ((Form) this).Close();
  }

  private void _regularPointColorButton_Click(object sender, EventArgs e)
  {
    this.beforeOpenColorDialog();
    this._colorDlg.Title = DnProcessSimulateCommands.JointVariableLimitsEditor.Resources.StringTable.TITLE_COLOR_DIALOG_REGULAR_POINT;
    this._colorDlg.Color = this._regularPointColorButton.SelectedColor;
    if (this._colorDlg.ShowDialog((IWin32Window) this) == DialogResult.OK)
    {
      this._regularPointColorButton.SelectedColor = this._colorDlg.Color;
      this._colorDlgSettings.CustomColors = this._colorDlg.CustomColors;
    }
    this.afterCloseColorDialog();
  }

  private void _selectedPointColorButton_Click(object sender, EventArgs e)
  {
    this.beforeOpenColorDialog();
    this._colorDlg.Title = DnProcessSimulateCommands.JointVariableLimitsEditor.Resources.StringTable.TITLE_COLOR_DIALOG_SELECTED_POINT;
    this._colorDlg.Color = this._selectedPointColorButton.SelectedColor;
    if (this._colorDlg.ShowDialog((IWin32Window) this) == DialogResult.OK)
    {
      this._selectedPointColorButton.SelectedColor = this._colorDlg.Color;
      this._colorDlgSettings.CustomColors = this._colorDlg.CustomColors;
    }
    this.afterCloseColorDialog();
  }

  private void _lineColorButton_Click(object sender, EventArgs e)
  {
    this.beforeOpenColorDialog();
    this._colorDlg.Title = DnProcessSimulateCommands.JointVariableLimitsEditor.Resources.StringTable.TITLE_COLOR_DIALOG_LINE_COLOR;
    this._colorDlg.Color = this._lineColorButton.SelectedColor;
    if (this._colorDlg.ShowDialog((IWin32Window) this) == DialogResult.OK)
    {
      this._lineColorButton.SelectedColor = this._colorDlg.Color;
      this._colorDlgSettings.CustomColors = this._colorDlg.CustomColors;
    }
    this.afterCloseColorDialog();
  }

  private void _areaColorButton_Click(object sender, EventArgs e)
  {
    this.beforeOpenColorDialog();
    this._colorDlg.Title = DnProcessSimulateCommands.JointVariableLimitsEditor.Resources.StringTable.TITLE_COLOR_DIALOG_AREA_COLOR;
    this._colorDlg.Color = this._areaColorButton.SelectedColor;
    if (this._colorDlg.ShowDialog((IWin32Window) this) == DialogResult.OK)
    {
      this._areaColorButton.SelectedColor = this._colorDlg.Color;
      this._colorDlgSettings.CustomColors = this._colorDlg.CustomColors;
    }
    this.afterCloseColorDialog();
  }

  protected virtual void Dispose(bool disposing)
  {
    if (disposing && this.components != null)
      this.components.Dispose();
    base.Dispose(disposing);
  }

  private void InitializeComponent()
  {
    ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof (CUiJVLEditorSettingsForm));
    this._graphGroupBox = new GroupBox();
    this._areaColorButton = new TxColorSelectButton();
    this._areaLabel = new Label();
    this._lineColorButton = new TxColorSelectButton();
    this._lineTypeCombo = new CUiJVLEditorImageComboBox();
    this._lineLabel = new Label();
    this._selectedPointColorButton = new TxColorSelectButton();
    this._selectedPointShapeCombo = new CUiJVLEditorImageComboBox();
    this._selectedPointLabel = new Label();
    this._regularPointColorButton = new TxColorSelectButton();
    this._regularPointShapeCombo = new CUiJVLEditorImageComboBox();
    this._regularPointLabel = new Label();
    this._okButton = new Button();
    this._cancelButton = new Button();
    this._graphGroupBox.SuspendLayout();
    ((Control) this).SuspendLayout();
    componentResourceManager.ApplyResources((object) this._graphGroupBox, "_graphGroupBox");
    this._graphGroupBox.Controls.Add((Control) this._areaColorButton);
    this._graphGroupBox.Controls.Add((Control) this._areaLabel);
    this._graphGroupBox.Controls.Add((Control) this._lineColorButton);
    this._graphGroupBox.Controls.Add((Control) this._lineTypeCombo);
    this._graphGroupBox.Controls.Add((Control) this._lineLabel);
    this._graphGroupBox.Controls.Add((Control) this._selectedPointColorButton);
    this._graphGroupBox.Controls.Add((Control) this._selectedPointShapeCombo);
    this._graphGroupBox.Controls.Add((Control) this._selectedPointLabel);
    this._graphGroupBox.Controls.Add((Control) this._regularPointColorButton);
    this._graphGroupBox.Controls.Add((Control) this._regularPointShapeCombo);
    this._graphGroupBox.Controls.Add((Control) this._regularPointLabel);
    this._graphGroupBox.Name = "_graphGroupBox";
    this._graphGroupBox.TabStop = false;
    componentResourceManager.ApplyResources((object) this._areaColorButton, "_areaColorButton");
    ((Control) this._areaColorButton).Name = "_areaColorButton";
    this._areaColorButton.SelectedColor = Color.White;
    componentResourceManager.ApplyResources((object) this._areaLabel, "_areaLabel");
    this._areaLabel.Name = "_areaLabel";
    componentResourceManager.ApplyResources((object) this._lineColorButton, "_lineColorButton");
    ((Control) this._lineColorButton).Name = "_lineColorButton";
    this._lineColorButton.SelectedColor = Color.White;
    this._lineTypeCombo.DrawMode = DrawMode.OwnerDrawFixed;
    this._lineTypeCombo.DropDownStyle = ComboBoxStyle.DropDownList;
    this._lineTypeCombo.FormattingEnabled = true;
    this._lineTypeCombo.ImagePaddingBottom = 0;
    this._lineTypeCombo.ImagePaddingLeft = 2;
    this._lineTypeCombo.ImagePaddingRight = 2;
    this._lineTypeCombo.ImagePaddingTop = 0;
    componentResourceManager.ApplyResources((object) this._lineTypeCombo, "_lineTypeCombo");
    this._lineTypeCombo.Name = "_lineTypeCombo";
    componentResourceManager.ApplyResources((object) this._lineLabel, "_lineLabel");
    this._lineLabel.Name = "_lineLabel";
    componentResourceManager.ApplyResources((object) this._selectedPointColorButton, "_selectedPointColorButton");
    ((Control) this._selectedPointColorButton).Name = "_selectedPointColorButton";
    this._selectedPointColorButton.SelectedColor = Color.White;
    this._selectedPointShapeCombo.DrawMode = DrawMode.OwnerDrawFixed;
    this._selectedPointShapeCombo.DropDownStyle = ComboBoxStyle.DropDownList;
    this._selectedPointShapeCombo.FormattingEnabled = true;
    this._selectedPointShapeCombo.ImagePaddingBottom = 0;
    this._selectedPointShapeCombo.ImagePaddingLeft = 0;
    this._selectedPointShapeCombo.ImagePaddingRight = 0;
    this._selectedPointShapeCombo.ImagePaddingTop = 0;
    componentResourceManager.ApplyResources((object) this._selectedPointShapeCombo, "_selectedPointShapeCombo");
    this._selectedPointShapeCombo.Name = "_selectedPointShapeCombo";
    componentResourceManager.ApplyResources((object) this._selectedPointLabel, "_selectedPointLabel");
    this._selectedPointLabel.Name = "_selectedPointLabel";
    componentResourceManager.ApplyResources((object) this._regularPointColorButton, "_regularPointColorButton");
    ((Control) this._regularPointColorButton).Name = "_regularPointColorButton";
    this._regularPointColorButton.SelectedColor = Color.White;
    this._regularPointShapeCombo.DrawMode = DrawMode.OwnerDrawFixed;
    this._regularPointShapeCombo.DropDownStyle = ComboBoxStyle.DropDownList;
    this._regularPointShapeCombo.FormattingEnabled = true;
    this._regularPointShapeCombo.ImagePaddingBottom = 0;
    this._regularPointShapeCombo.ImagePaddingLeft = 0;
    this._regularPointShapeCombo.ImagePaddingRight = 0;
    this._regularPointShapeCombo.ImagePaddingTop = 0;
    componentResourceManager.ApplyResources((object) this._regularPointShapeCombo, "_regularPointShapeCombo");
    this._regularPointShapeCombo.Name = "_regularPointShapeCombo";
    componentResourceManager.ApplyResources((object) this._regularPointLabel, "_regularPointLabel");
    this._regularPointLabel.Name = "_regularPointLabel";
    componentResourceManager.ApplyResources((object) this._okButton, "_okButton");
    this._okButton.Name = "_okButton";
    this._okButton.UseVisualStyleBackColor = true;
    this._okButton.Click += new EventHandler(this._okButton_Click);
    componentResourceManager.ApplyResources((object) this._cancelButton, "_cancelButton");
    this._cancelButton.DialogResult = DialogResult.Cancel;
    this._cancelButton.Name = "_cancelButton";
    this._cancelButton.UseVisualStyleBackColor = true;
    this._cancelButton.Click += new EventHandler(this._cancelButton_Click);
    ((Form) this).AcceptButton = (IButtonControl) this._okButton;
    componentResourceManager.ApplyResources((object) this, "$this");
    ((ContainerControl) this).AutoScaleMode = AutoScaleMode.Font;
    ((Form) this).CancelButton = (IButtonControl) this._cancelButton;
    ((Control) this).Controls.Add((Control) this._cancelButton);
    ((Control) this).Controls.Add((Control) this._okButton);
    ((Control) this).Controls.Add((Control) this._graphGroupBox);
    ((Form) this).FormBorderStyle = FormBorderStyle.FixedDialog;
    ((Form) this).MaximizeBox = false;
    ((Form) this).MinimizeBox = false;
    ((Control) this).Name = nameof (CUiJVLEditorSettingsForm);
    ((Form) this).ShowIcon = false;
    this._graphGroupBox.ResumeLayout(false);
    this._graphGroupBox.PerformLayout();
    ((Control) this).ResumeLayout(false);
  }

  private enum ePointShape
  {
    Square,
    SolidSquare,
    Diamond,
    SolidDiamond,
    Circle,
    SolidCircle,
    Count,
  }

  private enum eLineType
  {
    Width_1px,
    Width_2px,
    Width_3px,
    Width_4px,
    Width_5px,
    Count,
  }

  private class ColorDialogSettings
  {
    private Point? _pos;
    private int[] _customColors;

    internal ColorDialogSettings()
    {
      this._pos = new Point?();
      this._customColors = (int[]) null;
    }

    internal ColorDialogSettings(CUiJVLEditorSettingsForm.ColorDialogSettings other)
    {
      this._pos = other._pos;
      this._customColors = other._customColors != null ? ((IEnumerable<int>) other._customColors).ToArray<int>() : (int[]) null;
    }

    internal Point? Pos
    {
      get => this._pos;
      set => this._pos = value;
    }

    internal int[] CustomColors
    {
      get
      {
        return this._customColors != null ? ((IEnumerable<int>) this._customColors).ToArray<int>() : (int[]) null;
      }
      set
      {
        if (value != null)
          this._customColors = ((IEnumerable<int>) value).ToArray<int>();
        else
          this._customColors = (int[]) null;
      }
    }
  }
}
